package com.gdth.bank.activity;

import com.gdth.core.annotation.view.ViewInject;
import com.gdth.core.widget.BaseActivity;
import com.gdth.service.PhoneMediaRecorder;
import com.gdth.bank.R;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MediaRecorderActivity extends BaseActivity {
	
	@ViewInject(id=R.id.header_label_title) TextView txt_header_title;
	@ViewInject(id=R.id.header_btn_left, click="finishClick") TextView txt_header_left;
    @ViewInject(id=R.id.header_btn_right) TextView txt_header_right;
    
	@ViewInject(id=R.id.btn_start_recorder, click="start") Button txt_start_recorder;
	@ViewInject(id=R.id.btn_stop_recorder, click="stop") Button txt_stop_recorder;
	
    PhoneMediaRecorder recorder; 
    
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_media_recorder);
		
		initView();
	}
	
	private void initView(){
		txt_header_title.setText("录音测试");
		txt_header_right.setVisibility(View.GONE);
		
		recorder = new PhoneMediaRecorder();
	}
	

	public void start(View arg0){
		if (recorder != null){
			if (!recorder.isStarted()){
				recorder.start();
			}
		}
	}
	
	public void stop(View arg0){
		if (recorder != null){
			if (recorder.isStarted()){
				recorder.stop();
			}
		}
	}
}
